package nodes;

import nodes.visitor.NodeVisitor;

public class ParamNode<T> implements Node<T> {

	private int idx;
	
	public ParamNode(int idx) {
		this.idx = idx;
	}
	
	public void accept(NodeVisitor v) {
		v.visitParamNode(this);
	}
	
	public T evaluate(T[] param) {
		return param[idx];
	}
	
//	public void display(int indent) {
//		String in = new String();
//		for(int i = 0; i < indent; i++)
//			in = in + " ";
//		
//		System.out.println(in + "p" + idx);
//	}
	
	public Node<T> copyNode() {
		return new ParamNode<T>(idx);
	}
	
	public int getParam() {
		return idx;
	}
}
